home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-28 | 1.7 KB | 52 lines | [TEXT/RLAB] |
- readm:
-
- Syntax: readm ( "filename" )
- readm ( "filename" , ROW_SIZE )
-
- Description:
-
- Readm reads a generic matrix of data from the file denoted by
- the argument. The return value is the newly created matrix.
-
- The file format is generic ASCII. The rows of the matrix are
- separated by newlines, and the columns are separated by
- whitespace. Unnecessary newlines, either before, or after the
- data will confuse readm, and will probably result in an error
- message. Only one matrix can be stored in a file. If you need
- to store more than one matrix in a file, use write(), and
- read().
-
- Readm can only read in numeric matrices. The result of reading
- in string matrices is undefined.
-
- Example:
-
- 1 2 3 4
- 5 6 7 8
- 9 10 11 12
-
- The above values in a file called "test" would be read in like:
-
- > a = readm("test")
- a =
- matrix columns 1 thru 4
- 1 2 3 4
- 5 6 7 8
- 9 10 11 12
-
- Readm exists to read in data from other programs. In many
- cases a simple awk script will filter the other programs
- output into one or more columns of data. readm() will read the
- data into the matrix, then the matrix can be reshaped if
- necessary.
-
- Readm has no idea how many rows are in the matrix it is
- reading. This is because readm can work with pipes and process
- output where it gets the matrix as a stream. Readm uses a
- heuristic to guess how many rows of the matrix to allocate at
- one time. A second, optional argument, ROW_SIZE can be
- specified if the heuristic does not yield the performance you
- desire. The heuristic is purposely memory conservative.
-
- See Also: reshape, getline, open, read, readb, write, writeb, writem
-